package com.tepth.busfix.view.statebackground;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;

import com.tepth.busfix.R;

/**
 * Created by zhangyu on 2017/4/11.
 */

public class OneDrawableImageView extends AppCompatImageView {

    public OneDrawableImageView(Context context, AttributeSet attrs) {
        super(context);
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ImageBackground);
        int bgRes = ta.getResourceId(R.styleable.ImageBackground_android_background, -1);
        Drawable bgDrawable = OneDrawable.createBgDrawable(context, bgRes);
        setBackgroundDrawable(bgDrawable);
        ta.recycle();
    }
}
